package com.snail.eunms;

import lombok.Getter;

/**
 * @author ysc
 * @descrpiton 用来生成题目的枚举类
 * @date 2025/7/17 17:58
 **/
@Getter
public enum QuestionTypeEnum {
    SINGLE_CHOICE(1, "选择题"),
    MULTIPLE_CHOICE(2, "多选题"),
    FILL_IN_THE_BLANK(3, "填空题"),
    TRUE_FALSE(4, "判断题"),
    SHORT_ANSWER(5, "简答题");

    private final int code;
    private final String name;

    QuestionTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static QuestionTypeEnum fromCode(int code) {
        for (QuestionTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("无效的题目类型：" + code);
    }

    public String getPromptInstruction() {
        return switch (this) {
            case SINGLE_CHOICE -> "请生成  单项选择题（questionType为1）";
            case MULTIPLE_CHOICE -> "请生成  多项选择题（questionType为2）";
            case FILL_IN_THE_BLANK -> "请生成  填空题（questionType为3）";
            case TRUE_FALSE -> "请生成判断题（questionType为4）";
            case SHORT_ANSWER -> "请生成  简答题（questionType为5）";
        };
    }
}
